﻿using System;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Audio;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.GamerServices;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
using Microsoft.Xna.Framework.Media;
using Microsoft.Xna.Framework.Net;
using Microsoft.Xna.Framework.Storage;

namespace Barbarian.Win
{
    internal enum Stage
    {
        Intro = 0,
        LevelOne = 1
    };

    internal class Level
    {
        #region Private variables
        private Stage _level;
        private ContentManager _content;
        private Texture2D _background;
        private Player _player;
        #endregion
               
        public Level(Stage level, ContentManager content)
        {
            _level = Stage.Intro;
            _content = content;
            LoadContent();
        }

        private void LoadContent()
        {            
            _player = new Player(_content, new Vector2(123, 223));
            MediaPlayer.Play(_content.Load<Song>("Music/Theme"));        
            _background = _content.Load<Texture2D>("Backgrounds/Background1");
        }

        public void Update()
        {
            _player.Update();
        }

        public void Draw(GameTime gameTime, SpriteBatch spriteBatch)
        {            
            DrawBackground(spriteBatch);

            _player.Draw(gameTime, spriteBatch);
        }

        private void DrawBackground(SpriteBatch spriteBatch)
        {
            spriteBatch.Draw(_background, new Vector2() { X = 0, Y = 0 }, Color.White);
        }
    }
}
